//Tuesday, November 03 2009
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class DesignCalendar
{
public:
	int shortestPeriod(int dayLength, int yearLength)
	{
		return dayLength / gcd(dayLength, yearLength);
	}
	int gcd(int a, int b)
	{
		while (a>0 && b>0)
			if (a>b) a%=b; else b%=a;
		return a+b;
	}
};
